package zero.tech.core.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EngineLogUtil {
	private static Logger logger = LoggerFactory.getLogger(EngineLogUtil.class);

	public static void traceFull(Throwable e) {
		String msg = e.getMessage();
		StackTraceElement[] stacks = e.getStackTrace();
		for (int i = stacks.length - 1; i >= 0; i--) {
			int lineNumber = stacks[i].getLineNumber();
			String methodName = stacks[i].getMethodName();
			String className = stacks[i].getClassName();
			if (i == stacks.length - 1) {
				logger.error("=====线程名称:" + Thread.currentThread().getName() + " 当前代码执行到Class:" + className + "  方法:"
						+ methodName + "  行数:" + lineNumber + "  message:" + msg);
			} else {
				logger.error("=====线程名称:" + Thread.currentThread().getName() + " 当前代码执行到Class:" + className + "  方法:"
						+ methodName + "  行数:" + lineNumber);
			}
		}
	}
}
